<%@page import="bean.DepartmentEntity"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="java.util.*,bean.*" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
//构造foreach标签需要解析的数据
//将数据缓存在session对象中
//数据结构是list+entity表示查询的二维表结构
List lstDept=new ArrayList();
DepartmentEntity Dept1=new DepartmentEntity();
Dept1.setDepartment_id(11);
Dept1.setDepartment_name("agga");
Dept1.setLocation_id(103);
lstDept.add(Dept1);

 //将该数据放入session缓存中
 session.setAttribute("lstDept2222", lstDept);
 //session.removeAttribute("lstDept");

 
 for(Object eachVal:lstDept){
	 
 }

%>
<br/>
<!-- items是foreach标签便利的集合对象，一般使用el表达式从缓存中获取
var是当前本次遍历获取的值存在以var属性值为名字的一个变量中
 -->
<c:forEach items="${sessionScope.lstDept2222 }" var="eachVal">
<c:out value="${eachVal.department_id }"></c:out>
<c:out value="${eachVal.department_name }"></c:out>
<c:out value="${eachVal.location_id }"></c:out>
</c:forEach>

</body>
</html>